/*
 * @Author: your name
 * @Date: 2022-04-13 18:27:59
 * @LastEditTime: 2022-04-15 11:18:40
 * @LastEditors: Please set LastEditors
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: /yxfan-cli-dev-server/app/controller/templete.js
 */
'use strict';

const Controller = require('egg').Controller;

class TempleteController extends Controller {
	async getData() {
		const { ctx, service, app } = this;
		const doc = await service.project.find({});
		ctx.body = doc;
	}
	async insertData() {
		const { ctx, service, app } = this;
		const doc = await service.project.insert({
			a: 11,
			b: 22
		});

		ctx.body = doc;
	}
	async deleteData() {
		const { ctx, service, app } = this;
		const doc = await service.project.delete('remove', {
			a: 11,
			b: 22
		});

		ctx.body = doc;
	}
	async updateData() {
		const { ctx, service, app } = this;
		const doc = await service.project.update({ name: 'yxfan' }, { a: 111, b: 111 });
		ctx.body = doc;
	}
}

module.exports = TempleteController;
